﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using C;

namespace HCFramework.Product.ShoppingCart
{
    public partial class ShoppingCartSubColumn : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void ListView1_PreRender(object sender, EventArgs e)
        {
            if (C.ShoppingCart.ListCartItem.Count > 0)
            {
                panelContent.Visible = true;
                panelMessage.Visible = false;
            }
            else
            {
                panelContent.Visible = false;
                panelMessage.Visible = true;
            }

            ListView1.DataSource = C.ShoppingCart.ListCartItem;
            ListView1.DataBind();
        }

        protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                //int productId = (int)DataBinder.Eval(e.Item.DataItem, "ProductId");
                //CartItem cartItem = C.ShoppingCart.ListCartItem.Where(ik => ik.ProductId == productId).First();
                
            }
        }
    }
}